package com.tarena.util;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HbnUtils {
	private static SessionFactory sf = null;
	static {
		try {
			sf = new Configuration()
					.configure()
					.buildSessionFactory();
		} catch (HibernateException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 
	 * @return Session
	 */
	public static Session getSession() {
		Session s = null;
		try {
			s = sf.openSession();
		} catch (HibernateException e) {
			e.printStackTrace();
		}
		return s;
	}
}